#include "add_target.h"
#include "ui_add_target.h"
#include <qpalette.h>
#include <qdebug.h>
add_target::add_target(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::add_target)
{
    ui->setupUi(this);
    color = 0xff0000;
    ui->label_color->setStyleSheet("font-size:50px;color:rgb(255, 0, 0)");
}

add_target::~add_target()
{
    delete ui;
}
void add_target::on_pushButton_r_clicked()
{
    color = 0xff0000;
    ui->label_color->setStyleSheet("font-size:50px;color:rgb(255, 0, 0)");
}
void add_target::on_pushButton_b_clicked()
{
    color = 0x0055ff;
    ui->label_color->setStyleSheet("font-size:50px;color:rgb(0, 85, 255)");
}
void add_target::on_pushButton_h_clicked()
{
    color = 0x9d9d9d;
    ui->label_color->setStyleSheet("font-size:50px;color:rgb(157, 157, 157)");
}

void add_target::on_pushButton_o_clicked()
{
       emit send_data(ui->lineEdit_id->text().toInt(),
                      ui->lineEdit_type->text(),
                      color,
                      ui->spinBox_startdir->value(),
                      ui->spinBox_movedir->value(),
                      ui->spinBox_dis->value(),
                      ui->spinBox_speed->value());
    this->accept();
}

void add_target::on_pushButton_c_clicked()
{
    this->accept();
}
